/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAL;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author minhsong
 */
public class Dataconection {

    String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";

    String url = "jdbc:sqlserver://localhost:1433;databaseName=GiftShop";
    public static Connection DAOConnection = null;
    public static  CallableStatement proc_stmt = null;
    public static  PreparedStatement pre_stmt = null;
    public  static  ResultSet rs = null;
    public Dataconection() {
        DAOConnection = getConnection();
    }


    private Connection getConnection() {
        try {
            Class.forName(driver);

            return DriverManager.getConnection(url, "sa", "12345");

        } catch (SQLException ex) {
            Logger.getLogger(Dataconection.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Dataconection.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }
}
